import Vue from 'vue';
import App from './App';
import router from './router';

import axios from "axios";

Vue.config.productionTip = false;

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  render: h => h(App)
});

// 创建axios实例
const instance = axios.create({
  baseURL: 'http://httpbin.org',
  timeout: 2000
})
// 默认情况下是get请求，通过method指定请求类型
instance({
  url: '/post',
  method: 'post'
}).then(res => {
  console.log(res);
}).catch(err => {
  console.log(err);
});